package a;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;


public class Test2 {

	public static void main(String[] args) {
		
		String myName = "ashish";
		int myAge = 20;
		try {
			
			Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");
			PreparedStatement ps = con.prepareStatement("INSERT INTO detail(name,age) VALUES(?,?)");
			ps.setString(1, myName);
			ps.setInt(2, myAge);
			ps.executeUpdate(); 
			
			con.close();
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
	
}
